#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int n = 0;
    int y = 0;

    scanf("%d", &n);
    int x[n + 1];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &x[i]);
    }
    scanf("%d", &y);

    int j = 0;
    for (j = 0; j < n; j++)
    {
        if (y < x[j])
        {
            break;
        }
    }

    for (int a = n - 1; a >= j; a--)
    {
        x[a + 1] = x[a];
    }

    x[j] = y;

    for (int p = 0; p <= n; p++)
    {
        printf("%d ", x[p]);
    }

    return 0;
}